import { createSlice } from '@reduxjs/toolkit'




export const workplaceSlice = createSlice({
    // 当前切片名称
    name: 'workplace',
    // 保存公共数据
    initialState: {
        workplaceData: {}
    },
    // 修改state数据的公共方法
    reducers: {
        setWorkplace: (state, action) => {
            // action.payload 用来接收外部传递的数据
            state.workplaceData = action.payload;
        },

    },
})

// 将reducers中的方法暴露出去
export const { setWorkplace } = workplaceSlice.actions
export default workplaceSlice.reducer